package com.faymanwang.controller;

import com.faymanwang.service.DbGeneratorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * 代码生成器
 */
@Controller
@RequestMapping("/db/generator")
public class DbGeneratorController {
    @Autowired
    private DbGeneratorService dbGeneratorService;

    /**
     * 获取表中所有字段名称
     *
     * @param tableName 表名
     * @return
     */
    @ResponseBody
    @RequestMapping("/queryTable")
    public List<Map<String, String>> queryTable(@RequestParam String tableName) {

        //查表相关信息
        List<Map<String, String>> maps = dbGeneratorService.queryTableInfo(tableName);
        return maps;
    }


}
